package com.example.mylock;

import java.util.concurrent.CountDownLatch;

/**
 * description: CountDownLatchDemo <br>
 * date: 2021/3/22 14:02 <br>
 *
 * @author: ZhangYixin <br>
 * version: 1.0 <br>
 */
public class CountDownLatchDemo {

    public static void main(String[] args) {
        CountDownLatch count = new CountDownLatch(6);

        for (int i = 0; i < 6; i++) {
            count.countDown();
            System.out.println(i+1+"次使用");
        }

        try {
            count.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        System.out.println("---------结束");

    }

}
